<!DOCTYPE HTML SYSTEM "http://www.bitzermobile.com/bitzer/dtd/HTML401-loose-bitzer.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                <?php
                if (!$isBitzer) {
                echo '
                        <title>'.$GLOBALS["catalog_name"].'</title>
                        <LINK REL=StyleSheet HREF="',$app->appRoot,'include/style.css" TYPE="text/css" MEDIA=screen>
        <script type="text/javascript" src="',$app->appRoot,'include/niftycube.js"></script>
        <script type="text/javascript">
            window.onload=function(){
                                var width = "550px";
                                setAppRoot("',$app->appRoot,'");
                Nifty("div#container");
                Nifty("div#content,div#nav","same-height small");
                Nifty("div#header,div#footer","small");
                Nifty("ul.postnav a","transparent");
                                setWidth("div#container", width);
                                setWidth("div#content", width);
                                setWidth("div#footer", width);
            }
        </script>';
        }
                        ?>    
    </head>
    <body>
        <?php
                if (count($errors) == 0) {
                        if (!$isBitzer) {
                        echo '<div id="container">
                        <div id="header">
                                <table width="100%">
                                                        <tr>
                                                                <td width="95%"><h1>'.$moduleName;
			echo '</h1></td>
                                                                <td align="right" width="5%"><a href="',$app->appRoot,'Logout.php">Logout</a></td>
                                                        </tr>
                                                </table>
                        </div>
                        <div id="content">
                        <br>';
                        }
                        echo '<table data-bitzer-result="SUCCESS" data-bitzer-pk-name="id" data-bitzer-pk-value="',$result["id"],'" ';
                        if (!$isBitzer) {
                                echo 'class="list" width="100%"';
                        }
                        echo '>';
                        if (!$isBitzer) {
                echo '<tr><th>';
		if ($actionType == "DELETE")
			echo " Deleted";
		else
			echo " Saved";
		echo '</th></tr>';
                echo '    <tr><td>',$result["id"],'</td></tr>';
                        }
            echo '      </table>';
                        if (!$isBitzer) {
                                echo '
                <br>
                    <table>
                        <tr><td>
                                <ul class="postnav">
                                    <li><a href="Data.php">List</a></li>
                                </ul>
                            </td>
                        </tr>
                                        </table>
            </div>
            <div id="footer"></div>
        </div>';
                        }
                } else {
                        if (!$isBitzer) {
                        echo '<div id="container">
                        <div id="header">
                                <table width="100%">
                                                        <tr>
                                                                <td width="95%"><h1>Errors</h1></td>
                                                                <td align="right" width="5%"><a href="/mysugar/Logout.php">Logout</a></td>
                                                        </tr>
                                                </table>
                        </div>
                        <div id="content">
                        <br>';
                        }
                        echo '<table data-bitzer-result="MESSAGE" data-bitzer-pk-name="id" data-bitzer-pk-value="',$id,'" ';
                        if (!$isBitzer) {
                                echo 'class="list" width="100%"';
                        }
                        echo '>';
                        if (!$isBitzer) {
                echo '            <tr><th>Errors</th></tr>';
                        }
                        if ($errors['bitzer-global'] != "") {
                                echo '<tr><td data-bitzer-type="ERROR">',$errors['bitzer-global'],'</td></tr>';

                        } else {
                                foreach ($errors as $key => $error) {
                                        echo '<tr><td data-bitzer-message-type="ERROR" data-bitzer-field="',$key,'">',$error,'</td></tr>';
                                }
                        }
                        echo '</table>';

            if (!$isBitzer) {
               echo '
                <br>
                    <table>
                        <tr><td>
                                <ul class="postnav">
                                    <li><a href="Data.php">List</a></li>
                                </ul>
                            </td>
                        </tr>
                                        </table>
            </div>
            <div id="footer"></div>
        </div>';
                        }

                }
                ?>
    </body>
</html>

